<?php


//注意编码utf-8
class CDE_SHORT{
    private static $num62 = 'gkQoNXs6u0aYrVLhS7iFWE5JzZCcd8OeBRGxI3Kv2mtDyqPTfMl1Hpwbn4jUA9';//不可修改    
    /**解码**/
    public static function any2Dec($number, $fromRadix=62) {
            $dec = 0;
            $num62=self::$num62;           
            $len = strlen($number) - 1;
            for ($t = 0; $t <= $len; $t++) {                
                $dec = bcadd(bcmul($dec, $fromRadix), strpos($num62, $number[$t]));
            }
            return $dec;
    }
    
        /**编码**/
		public static function dec2Any($dec, $toRadix=62) {
            
        
            $num62=self::$num62;
            if ($toRadix < 2 || $toRadix > 62) {
                $toRadix = 2;
            }
            if ($toRadix == 10) {
                return $dec;
            }
            // -Long.MIN_VALUE 转换为 2 进制时长度为65
            $buf = array();
            $charPos = 64;
            $isNegative = $dec < 0; 
            if (!$isNegative) {
                $dec = -$dec; // bcsub(0, $dec);
            }

            while (bccomp($dec, -$toRadix) <= 0) {
                $buf[$charPos--] = $num62[-bcmod($dec, $toRadix)];
                $dec = bcdiv($dec, $toRadix);
            }
            $buf[$charPos] = $num62[-$dec];
            if ($isNegative) {
                $buf[--$charPos] = '-';
            }
            $_any = '';
            for ($i = $charPos; $i < 65; $i++) {
                $_any .= $buf[$i];
            }
            return $_any;
        }
		
		public static function makeRnd(){
			
			$num62=self::$num62;
			$a=str_split($num62);
			shuffle($a);
			$num62=join('',$a);
			var_dump($num62);
			
		}
		
}

CDE_SHORT::makeRnd();


$a=$_GET['id'];

echo '<p>--加密--</p>';
$ajiami=CDE_SHORT::dec2Any($a);
var_dump('￥'.$ajiami.'￥');
echo "<br/>";
echo '<p>--解密密--</p>';
$ajiemi=CDE_SHORT::any2Dec($ajiami);
var_dump($ajiemi);

?>